Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mail): Fix big logos in mail templates for Outlook #46419

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

nickvergessen
Copy link
Member

@nickvergessen nickvergessen commented Jul 10, 2024

Case Before After
Huge image 3308-1758-max 2188-710-max
Mini image 2188-740-max2

Todo

  • Create repair step to cache the image size on update
  • Adjustments for enterprise logo

Checklist

@nickvergessen nickvergessen force-pushed the bugfix/noid/limit-logo-size-for-outlook branch from ec3f2a7 to 7e6ce49 Compare July 11, 2024 06:54
@nickvergessen
Copy link
Member Author

Added the repair step and pinged the release crew to ask about the enterprise logo

@@ -186,6 +186,10 @@
} catch (NotFoundException $e) {
} catch (NotPermittedException $e) {
}

if ($key === 'logo') {
$this->config->deleteAppValue('theming', 'logoDimensions');

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OCP\IConfig::deleteAppValue has been marked as deprecated
@nickvergessen nickvergessen force-pushed the bugfix/noid/limit-logo-size-for-outlook branch from 7e6ce49 to 0252003 Compare July 16, 2024 14:08
if ($key === 'logo') {
$newImage = @imagecreatefromstring(file_get_contents($tmpFile));
if ($newImage !== false) {
$this->config->setAppValue('theming', 'logoDimensions', imagesx($newImage) . 'x' . imagesy($newImage));

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OCP\IConfig::setAppValue has been marked as deprecated
apps/theming/lib/ImageManager.php Fixed Show fixed Hide fixed
@nickvergessen nickvergessen force-pushed the bugfix/noid/limit-logo-size-for-outlook branch from 0252003 to c9842b6 Compare July 17, 2024 06:57
} elseif (str_starts_with($detectedMimeType, 'image/svg')) {
$matched = preg_match('/viewbox=["\']\d* \d* (\d*\.?\d*) (\d*\.?\d*)["\']/i', $content, $matches);
if ($matched) {
$this->config->setAppValue('theming', 'logoDimensions', $matches[1] . 'x' . $matches[2]);

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OCP\IConfig::setAppValue has been marked as deprecated
$this->config->setAppValue('theming', 'logoDimensions', $matches[1] . 'x' . $matches[2]);
} else {
$this->logger->warning('Could not read logo image dimensions to optimize for mail header');
$this->config->deleteAppValue('theming', 'logoDimensions');

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OCP\IConfig::deleteAppValue has been marked as deprecated
}
} else {
$this->logger->warning('Could not read logo image dimensions to optimize for mail header');
$this->config->deleteAppValue('theming', 'logoDimensions');

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OCP\IConfig::deleteAppValue has been marked as deprecated
@nickvergessen nickvergessen force-pushed the bugfix/noid/limit-logo-size-for-outlook branch from c9842b6 to 37154e2 Compare July 17, 2024 07:18
Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen nickvergessen force-pushed the bugfix/noid/limit-logo-size-for-outlook branch from 37154e2 to 693a81b Compare July 17, 2024 07:25
@nickvergessen nickvergessen merged commit 0588899 into master Jul 17, 2024
164 of 166 checks passed
@nickvergessen nickvergessen deleted the bugfix/noid/limit-logo-size-for-outlook branch July 17, 2024 09:54
@nickvergessen
Copy link
Member Author

/backport to stable29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants